Efficient rate allocation for multi-resolution coding of data

ABSTRACT

There are disclosed three fast rate control methods that can efficiently reduce or remove the computation and memory usage redundancy over conventional PCRD methods. The first method, called successive bit-plane rate allocation (SBRA), assigns the maximum allowable bit-rate for each bit-plane of each code-block by using the currently available rate-distortion information only. The second method is called priority scanning rate allocation (PSRA). This first predicts the order of magnitude of each truncation point&#39;s rate-distortion slope and then encodes the truncation points based on the order (priority) information. The third method uses PSRA to obtain a significantly smaller amount of data than PCRD for optimal truncation and is called priority scanning with optimal truncation (PSOT). SBRA provides the highest computational complexity and memory usage reduction, and the lowest coding/transmission delay. The computational complexity reduction can be up to about 90% of the entropy coding process. However this method gives the lowest PSNR performance of the three. PSRA provides higher PSNR performance than SBRA with the penalty of lower memory usage reduction and higher delay PSOT provides the best (optimal) quality while it is the least efficient method in term of computational complexity, memory usage and the coding/transmission delay. The three methods provide different degree of computation complexity and memory reduction, coding/transmission delay and PSNR performance. The most suitable rate control method can be chosen based on application requirements.

FIELD OF THE INVENTION

[0001] This invention relates generally to digital signal compression,coding and representation, and more particularly to an imagecompression, coding and representation system using rate control or rateallocation and having both device and method aspects. It further relatesto a computer program product, such as a recording medium, carryingprogram instructions readable by a computing device to cause thecomputing device to carry out a method according to the invention.

BACKGROUND OF THE INVENTION AND PRIOR ART

[0002] Due to the huge size of the raw data of digital signals,compression must be applied to the raw signals so that they may betransmitted and stored. The digital signals can be video, image,graphics, audio, speech, etc. In particular, digital image signals canbe very large in size. Digital cameras can be used to capture highresolution images that can easily have a resolution of 10 mega-pixels orhigher. Many remote sensing images or map images can have very highresolution as well. Image compression is very important for the storage,transmission and representation of such digital images.

[0003] One important international standard for image compression is theISO/IEC 10918 standard, known commonly as the JPEG (Joint PhotographicExperts Group) standard [G. K. Wallace, “The JPEG Still PictureCompression Standard,” IEEE Trans. On Consumer Electronics, vol. 38, no.1, February 1992.]. The JPEG standard was finished in early 1990s andhas since been used widely in internet and digital cameras. In the year2000, ISO/IEC produced a new standard ISO/IEC 15444, known commonly asthe JPEG2000 standard [ISO/IEC, ISO/IEC 15444-1: Informationtechnology—JPEG 2000 image coding system—Part 1: Core coding system,2000: ISO/IEC, ISO/IEC 15444-2: Information technology—JPEG 2000 imagecoding system—Part 2: Extensions, 2000:C. Christopoulos, et. al., “TheJPEG2000 Still Image Coding System: An Overview,” IEEE Trans. onConsumer Electronics, vol. 46, no. 4, Nov. 2000.], which can give bothobjective and subjective image quality superior to JPEG.

[0004] Baseline JPEG uses mainly discrete cosine transform (DCT), scalarquantization and variable length coding such as runlength coding,Huffman coding and arithmetic coding. On the other hand, JPEG2000comprises discrete wavelet transform (DWT), scalar quantization,combined bit plane and arithmetic coding, and optimal rate control. Ratecontrol or rate allocation is an algorithm or strategy to control thebit-rate of the signal coding such that it meets the target bandwidth,end-to-end delay and/or storage requirement. The ultimate target of ratecontrol is to allocate the target bit-rate in the encoding of the signalsuch that the overall distortion can be minimized. In JPEG, the bit-rateis controlled by a single global value of quantization factor (orquality factor). As a result, the bit rate control is not accurate andthe visual quality may vary from one region of the image to another. Byusing the bit-plane coding, JPEG2000 can control the bit-rate to meetthe bit-rate requirement precisely and easily. And the bit rate iscontrolled locally and thus can be adapted to the local imagecharacteristics.

[0005] The basic encoding algorithm of JPEG2000 is based on EmbeddedBlock Coding with Optimized Truncation or EBCOT [D. Taubman, “HighPerformance Scalable Image Compression with EBCOT,” IEEE Trans. on ImageProcessing, vol. 9, no. 7, July 2000.]. The EBCOT algorithm partitionsthe wavelet coefficient into non-overlapped rectangle blocks calledcode-blocks. The code-block data are then entropy encoded by bit-planecoding. A rate-distortion optimization (optimal bit allocation) processis applied after all the quantized wavelet coefficients have beenentropy encoded (compressed) and is referred to as post-compressionrate-distortion (PCRD) optimization [D. Taubman, “High PerformanceScalable Image Compression with EBCOT,” IEEE Trans. on Image Processing,vol. 9, no. 7, July 2000: H. Everett, “Generalized Lagrange MultiplierMethod for Solving Problems of Optimum Allocation of Resources,” Oper.Res., vol.11, pp. 399-417, 1963.]. By utilizing the actualrate-distortion functions of all compressed data, the PCRD techniqueachieves minimum image distortion for any given bit-rate. However, sinceit requires the encoding of all the data and the storage of all theencoded bit-stream even though a large portion of the data needs not tobe sent out, most of the computation and memory usage could be redundantin this process. Also the PCRD is an off-line process such that thewhole image needs to be completely encoded before sending out any dataand hence long delay is possible.

[0006] Another technique for the optimal rate allocation of JPEG2000 isby coefficients modelling. Kasner et al. [J. H. Kasner, M. W. Marcellinand B. R. Hunt, “Universal Trellis Coded Quantization,” IEEE Trans. onImage Processing, vol. 8, no. 12, pp. 1677-1687, December 1999.] assumedthat the wavelet coefficients could be modelled by memory-lessgeneralized-Gaussian density (GGD). By estimating the GGD parameter, therate-distortion function can be approximated as required for the optimalrate allocation. This approach is included in Part-2 of JPEG2000[ISO/IEC, ISO/IEC 15444-2: Information technology—JPEG 2000 image codingsystem—Part 2: Extensions, 2000.] and is called Lagrangian rateallocation (LRA). In this approach, both the rate and distortion areestimated before actually encoding the wavelet coefficients. Aquantization step-size of each sub-band is selected based on theestimation and the quantized wavelet coefficients are encoded withoutany truncation. This approach does not have the issue of redundantcomputation cost and redundant memory usage. However the rate controlaccuracy is heavily depended on the coefficients following theassumption of GGD. An iterative technique is often required to convergeon the target bit-rate. In each iteration, the quantization step-sizesare required to be re-estimated and the wavelet coefficients are thusquantized and entropy encoded again. The multiple quantization andentropy encoding processes heavily increase the complexity of thisapproach. In practice, the complexity of LRA is comparable to the PCRDapproach.

[0007] Other than the empirical PCRD approach and the analytical LRAapproach, Masuzaki et. al. [T. Masuzaki, et. al., “JPEG2000 AdaptiveRate Control for Embedded Systems,” Proc. IEEE Int. Sym. on Circuits andSystems, vol. 4, pp. 333-336, May 2002.] first proposed a non-optimaltraining-image based fast rate control method for JPEG2000. By traininga set of test images using the PCRD method, the proposed fast methodobtains the relationship between the number of coding passes (codingpoints) and the corresponding number of bytes within a sub-band. Therelationship is then approximated by a linear curve. Given a targetbit-rate, the fast method can predict the number of coding passes to beincluded in the final output using the linear model. However the resultsof the paper show that this method can suffer from a significant PSNRloss (>1dB in 0.25 bpp). The loss could be much more significant as asingle liner function cannot well approximate different kind of images.

[0008] Model based rate allocation is an attractive approach for fastrate control as it can provide the optimal quality when the coefficientsfollow the model assumption. However the major drawback is the degree ofmodel accuracy. It is unlikely that an accurate model can be found forhighly varied images. Thus we change our thought into non-model basedfast rate control method.

[0009] JPEG2000, as noted previously, is the new international standardfor still image coding. JPEG2000 is based on the discrete wavelettransform (DWT), scalar quantization, coefficient bit modelling,arithmetic coding and rate control. The DWT decomposes an image (orsub-image called tile) into sub-bands for with different level ofdecomposition. FIG. 1 shows an example of two-level DWT decomposition.The sub-bands consist of coefficients that represent the horizontal andvertical spatial frequency characteristics of the image/tile. Eachsub-band is then quantized by a scalar quantizer and divided intonon-overlapped rectangular blocks (called code-blocks in JPEG2000) withsize typically 64×64 or larger. The quantized code-block data areentropy encoded (compressed) to form a code-block bit-stream. Each ofthe code-block bit-stream can be truncated to meet the target bit-rateby rate control and finally output to the channel in packet format.

[0010] After transformation, the wavelet coefficients are quantizedusing scalar quantization. Each of the coefficients a_(b)(x,y) of thesub-band b is quantized to the value q_(b)(x,y) by $\begin{matrix}{{q_{b}\left( {x,y} \right)} = {{{sign}\left( {a_{b}\left( {x,y} \right)} \right)} \cdot \left\lfloor \frac{{a_{b}\left( {x,y} \right)}}{\Delta_{b}} \right\rfloor}} & (1)\end{matrix}$

[0011] where Δ_(b) is the quantization step size.

[0012] In lossless compression, the value of Δ_(b) must be one for allsub-bands. However, in lossy compression, no particular selection of thequantization step size is required in the standard. One effective way inselecting the quantization step size is to scale a default (orpre-defined) step size Δ_(d) by an energy weight parameter γ_(b) [J. W.Woods, J. Naveen, “A Filter Based Bit Allocation Scheme for SubbandCompression of HDTV,” IEEE Trans. on Image Processing, vol. 1, no. 3,pp. 436-440, July 1992.] by $\begin{matrix}{\Delta_{b} = \frac{\Delta_{d}}{\sqrt{\gamma_{b}}}} & (2)\end{matrix}$

[0013] This selection of quantization step size is recommended in thestandard and is implemented in the standard reference software [M. D.Adams and F. Kossentini, “JasPer: A Software-based JPEG-2000 CodecImplementation,” Proc. IEEE Int. Conf. On Image Processing, vol. 2, pp.53-56, October 2000: M. D. Adams, “JasPer project home page,”http://www.ece.uvic.ca/˜mdadams/jasper, 2000.] with the default stepsize Δ_(d) equal to two for all sub-bands.

[0014] The quantized wavelet coefficients in the code-blocks are encodedusing coefficient bit modelling and arithmetic coding. This process iscalled tier-1 coding in JPEG2000. Tier-1 coding is essentially abit-plane coding technique that is commonly used in wavelet based imagecoders [J. M. Shapiro, “Embedded Image Coding using Zerotrees of WaveletCoefficients,” IEEE Trans. on Signal Processing, vol. 41, no. 12, pp.3445-3462, December 1993: A. Said, W. A. Pearlman, “A New, Fast, andEfficient Image Codec Based on Set Partitioning in Hierarchical Trees,”IEEE Trans. on Circuits and Systems for Video Tech., vol. 6, no. 3, pp.243-250, June 1996.]. In tier-1 coding, code-blocks are encodedindependently of one another using exactly the same coding algorithm.For each code-block, coefficients are encoded starting from the mostsignificant bit-plane (MSB) with a non-zero element towards the leastsignificant bit-plane (LSB). Each coefficient bit in a bit-plane isselected to be included in only one of the three coding passes calledsignificance pass, refinement pass and cleanup pass by using coefficientbit modelling. The coding pass data are then arithmetic encoded by acontext-based adaptive binary arithmetic coder called MQ coder inJPEG2000.

[0015] Rate control in JPEG2000 is achieved partly by the quantizationand partly by the selection of the coding pass data to be included inthe final output (code-stream). The quantization process as mentionedbefore roughly controls the rate that is generally far from the targetbit-rate and is applied only once. The accurate rate control is achievedby selecting part of the coding pass data to be included in the finalcode-stream. JPEG2000 has no requirement on which rate control method tobe used. However an optimal rate control process called post-compressionrate-distortion (PCRD) optimization is recommended in the standard. Thisprocess had been described in D. Taubman, “High Performance ScalableImage Compression with EBCOT,” IEEE Trans. on Image Processing, vol. 9,no. 7, July 2000 clearly and we will summarize it as follow.

[0016] Let {B_(i)}_(i=1,2, . . .) denote the set of all the code-blocksthat cover the whole image/tile. For each code-block, an embeddedbit-stream is formed by the tier-1 coding with a set of allowabletruncation points each of which is located at the end of each codingpass. Thus there is at most three truncation points for each bit-plane.For any code block B_(i), the bit-stream can be truncated into differentdiscrete length with bit-rate R_(i) ¹, R_(i) ², . . . . Thecorresponding distortion incurred by reconstructing those truncatedbit-streams is denoted by D_(i) ^(n) ^(_(i)) at truncation pointn_(i)=1, 2, . . . . The optimal rate control process is to select thetruncation points which minimize the overall reconstructed imagedistortion D where $\begin{matrix}{D = {\sum\limits_{i}D_{i}^{n_{i}}}} & (3)\end{matrix}$

[0017] subject to the rate constraint $\begin{matrix}{R = {{\sum\limits_{i}R_{i}^{n_{i}}} \leq R_{budget}}} & (4)\end{matrix}$

[0018] where R_(budget) denotes the target bit-rate.

[0019] Using the Lagrange multiplier technique [D. Taubman, “HighPerformance Scalable Image Compression with EBCOT,” IEEE Trans. on ImageProcessing, vol. 9, no. 7, July 2000: H. Everett, “Generalized LagrangeMultiplier Method for Solving Problems of Optimum Allocation ofResources,” Oper. Res., vol. 11, pp. 399-417, 1963.], the optimizationprocess is equivalent to minimize the cost function $\begin{matrix}{J = {{D + {\lambda \quad R}} = {\sum\limits_{i}\left( {D_{i}^{n_{i{(\lambda)}}} + {\lambda \quad R_{i}^{n_{i}{(\lambda)}}}} \right)}}} & (5)\end{matrix}$

[0020] Therefore if we can find a value of λ such that the set oftruncation points {n_(i)(λ)} which minimizes (5) and the maximumachievable rate satisfies the rate constraint in (4) will be the optimaltruncation points for a target bit-rate.

[0021] A simple algorithm in finding the optimal truncation points ismentioned in Taubman. At any truncation point n_(i), the R-D “slope” isgiven by $\begin{matrix}{S_{i}^{n_{i}} = {\frac{\Delta \quad D_{i}^{n_{i}}}{\Delta \quad R_{i}^{n_{i}}} = \frac{D_{i}^{n_{i} - 1} - D_{i}^{n_{i}}}{R_{i}^{n_{i}} - R_{i}^{n_{i} - 1}}}} & (6)\end{matrix}$

[0022] In the rest of the paper, the term R-D slope is always referredto Eqn. (6). Assume N_(i) be the set of available truncation points forcode-block B_(i). The truncation point n_(i)(λ) for a given value of λis found such that

n _(i)(λ)=max{j∈N _(i) |S _(i) ^(j)≧λ}  (7)

[0023] where j=1, 2, . . . is the truncation point index. However thisequation is only true when the R-D slope is monotonically decreasing(S_(i) ^(n) ^(_(i)) ⁺¹≦S_(i) ^(n) ^(_(i)) ). Thus the monotonicallydecreasing property is assumed in the optimization algorithm. Based onthe monotonically decreasing property, the optimal value of λ denoted asλ_(optimal) is equal to the minimum value of λ which satisfies the rateconstraint in (4). In practice, an iterative approach with fastconvergence is often used in searching the λ_(optimal). Once theλ_(optimal) is found, the optimal truncation points can be found by (7)with λ=λ_(optimal).

[0024] In the PCRD algorithm, the R-D slope information of all theavailable truncation points are required to be pre-computed and storedin memory. This requires tier-1 encoding of all the quantizedcoefficients and the whole encoded bit-stream must be stored in memoryeven though a large portion of them will not be included in the finaloutput after the optimal truncation. Therefore a significant portion ofcomputational power and working memory size is wasted on computing andstoring the unused data. We call this portion of computational power andworking memory size to be redundant computational cost and redundantmemory usage respectively. Also the PCRD method is a non-causal oroff-line process because the entire image/tile needs to be completelyencoded before sending out any data and hence long transmission delay ispossible. Since the PCRD method requires tier-1 encoding of all thequantized coefficients, the computational complexity can be about 40% to60% of the total CPU execution time [M. D. Adams and F. Kossentini,“JasPer: A Software-based JPEG-2000 Codec Implementation,” Proc. IEEEInt. Conf On Image Processing, vol. 2, pp. 53-56, October 2000: K. F.Chen, C. J. Lian, H. H. Chen and L. G. Chen, “Analysis and ArchitectureDesign of EDCOT for JPEG-2000,” Proc. IEEE Int. Sym. Of Circuits andSystems, vol. 2, pp. 765-768, May 2001.].

SUMMARY OF THE PRESENT INVENTION

[0025] According to broad aspects of the present invention there areprovided three novel fast rate control methods that can efficientlyreduce or remove the computation and memory usage redundancy over theconventional PCRD method. The first method, called successive bit-planerate allocation (SBRA), assigns the maximum allowable bit-rate for eachbit-plane of each code-block by using the currently availablerate-distortion information only. The second method is called priorityscanning rate allocation (PSRA). This first predicts the order ofmagnitude of each truncation point's rate-distortion slope and thenencodes the truncation points based on the order (priority) information.The third method uses PSRA to obtain a significantly smaller amount ofdata than PCRD for optimal truncation and is called priority scanningwith optimal truncation (PSOT).

[0026] In a comparison of the three methods, SBRA provides the highestcomputational complexity and memory usage reduction, and the lowestcoding/transmission delay. The computational complexity reduction can beup to about 90% of the entropy coding process. However this method givesthe lowest PSNR performance of the three. PSRA provides higher PSNRperformance than SBRA with the penalty of lower memory usage reductionand higher delay. PSOT provides the best (optimal) quality while it isthe least efficient method in term of computational complexity, memoryusage and the coding/transmission delay. The three methods providedifferent degree of computation complexity and memory reduction,coding/transmission delay and PSNR performance. The most suitable ratecontrol method can be chosen based on application requirements.

BRIEF DESCRIPTION OF THE FIGURES

[0027] Some embodiments of the invention will now be described for thesake of example only with reference to the following figures, in which:

[0028]FIG. 1 illustrates an example of a two-level digital waveletdecomposition into subbands,

[0029]FIG. 2. shows a plot of R-D ratio curve of first code-block fortest image ‘Lena’,

[0030]FIG. 3 shows the indexing of subbands. Each subband is indexed bya resolution level and an orientation (r,θ). This example shows a threelevel DWT decomposition,

[0031]FIG. 4 shows selected test images,

[0032]FIG. 5 shows the average rate difference between PCRD and SBRA-1(PCRD-SBRA-1) for sixteen subbands at different target bit-rates,

[0033]FIG. 6 shows the scan order of (a) subband and (b) code blockwithin a subband, and

[0034]FIG. 7 shows the average PSNR difference between PCRD and SBRA-w(PCRD-SBRA-w) for different values of Δ at different target bit-rates.

DETAILED DESCRIPTION OF PREFERRED EMBODIMENTS

[0035] The present invention seeks to provide new and useful ratecontrol techniques for JPEG2000 image coding in particular and otherforms of data coding in general.

[0036] A first aspect of the present invention (“successive bit-planerate allocation” or “SBRA”) proposes that, in the determination ofwhether or not to include a coding pass in the final code-stream, arate-distortion value (R-D value) is computed and compared with anadaptive threshold. If the R-D ratio is larger than or equal to athreshold, the coding pass would be included. This is a causal methodwhich can make the decision immediately, without waiting for futurecode-blocks to be processed or encoded.

[0037] PCRD incurs significant encoding delay because it selects thetruncation points only after the complete tier-1 encoding of all thecode-blocks. For a real-time, low delay rate control process, it isdesirable that the compressed data of the early code-blocks can be sentout before the later code-blocks are being encoded. The ideal way to dothis is to select the truncation point of a code-block in a casualmanner, in parallel with the tier-1 coding. This can also eliminate theredundant computation and memory usage. However, without knowing theactual R-D slopes of the data, it is impossible to find the optimaltruncation point. So, instead of finding the optimal truncation point,we propose to find a good truncation point which is close to the optimalpoint in parallel with the tier-1 coding.

[0038] Recall that the optimal truncation point for any code-block B_(i)is found by Eqn. (7) with λ=λ_(optimal). Eqn. (7) requires that the R-Dslope at all allowable truncation points to be pre-computed. However, ina causal rate control process, code-blocks are encoded one afteranother. When the code-block B_(i) is being encoded, all the R-D slopeinformation of the future code-blocks {B_(j)}_(j>i) is unknown. Thus theλ_(optimal) cannot be determined.

[0039] Instead of finding the λ_(optimal), an approximation approachwill be used here in order to obtain a causal rate control process whichcan be done in parallel with the tier-1 coding. We note that thecondition S_(i) ^(j)≧λ from Eqn. (7) and becomes $\begin{matrix}{S_{i}^{n_{i}} = {\frac{\Delta \quad D_{i}^{n_{i}}}{\Delta \quad R_{i}^{n_{i}}} = {\frac{D_{i}^{n_{i} - 1} - D_{i}^{n_{i}}}{R_{i}^{n_{i}} - R_{i}^{n_{i} - 1}} \geq \lambda_{optimal}}}} & (8) \\{A_{i}^{n_{i} - 1} \equiv \frac{D_{i}^{n_{i} - 1}}{\Delta \quad R_{i}^{n_{i}}} \geq {\lambda_{optimal} + \frac{D_{i}^{n_{i}}}{\Delta \quad R_{i}^{n_{i}}}}} & (9) \\{A_{i}^{n_{i} - 1} \geq \alpha_{i}^{n_{i}}} & (10)\end{matrix}$

[0040] Now the condition S_(i) ^(n) ^(_(i)) ≧λ_(optimal) becomes A_(i)^(n) ^(_(i)) ⁻¹≧α_(i) ^(n) ^(_(i)) in the optimal case and the termA_(i) ^(n) ^(_(i)) ⁻¹ is called R-D ratio. There are two approximationsin Eqn. (10). The first approximation is that the R-D slope at a currenttruncation point n_(i) is approximated by the R-D ratio of previoustruncation point n_(i)−1. The second approximation is that the constantλ_(optimal) is now approximated by a variable α_(i) ^(n) ^(_(i)) fordifferent code-blocks and truncation points. As we do not know theλ_(optimal), the optimal value of α_(i) ^(n) ^(_(i)) cannot be foundtoo. However we are not going to find the optimal truncation points. Agood value of α_(i) ^(n) ^(_(i)) can be simply found by using the rateconstraint in Eqn. (4).

[0041] Let the i^(th) code-block B_(i) be the code-block currently beingencoded. Then {B_(j)}_(j<i) is the set of previously encoded code-blockswith corresponding truncation point {n_(j)}_(j<i) and {B_(j)}_(j>i) isthe set of future code-blocks. We denote {B_(j)}_(j<i) and {B_(j)}_(j>i)as B_(c) and B_(u) respectively. For the current code-block B_(i), wefurther assume that the coefficients at and before an allowabletruncation point c have been encoded such that at the final truncationpoint will satisfy n_(i)≧c . This implies R_(i) ^(n) ^(_(i)) ≧R_(i)^(c). We then define D_(remain) and R_(remain) as $\begin{matrix}{{D_{remain} = {D_{i}^{c} + {\sum\limits_{k \in B_{u}}D_{k}^{0}}}}{and}} & (11) \\{R_{remain} = {{R_{budget} - R_{i}^{c} - {\sum\limits_{k \in B_{c}}R_{k}^{n_{k}}}} \geq 0}} & (12)\end{matrix}$

[0042] Using Eqn. (12), the rate constraint in Eqn. (4) can be rewrittenas $\begin{matrix}{{R_{i}^{n_{i}} - R_{i}^{c} + {\sum\limits_{k \in B_{u}}R_{k}^{n_{k}}}} \leq R_{remain}} & (13)\end{matrix}$

[0043] By summing over current and all uncoded code-blocks, thecondition in Eqn. (10) becomes $\begin{matrix}{{D_{i}^{c} + {\sum\limits_{k \in B_{u}}D_{k}^{0}}} \geq {{\alpha_{i}^{n_{i}}\left( {R_{i}^{n_{i}} - R_{i}^{c}} \right)} + {\sum\limits_{k \in B_{u}}{\alpha_{k}^{n_{k}}\left( {R_{k}^{n_{k}} - R_{k}^{0}} \right)}}}} & (14)\end{matrix}$

[0044] where R_(k) ⁰ is the rate that the bit-stream is totallytruncated. So its value is zero. As the R-D ratio A_(i) ^(n) ^(_(i)) ⁻¹is used to approximate the R-D slope S_(i) ^(n) ^(_(i)) in Eqn. (10), wecan assume that the term D_(i) ^(n) ^(_(i)) /ΔR_(i) ^(n) ^(_(i)) in Eqn.(9) is constant in the sense that all the code-block bit-streams aretruncated at the same R-D ratio. This also assumes that α_(i) ^(n)^(_(i)) is constant. The equation in Eqn. (14) then becomes$\begin{matrix}{{D_{i}^{c} + {\sum\limits_{k \in B_{u}}D_{k}^{0}}} \geq {\alpha_{i}^{n_{i}}\left( {R_{i}^{n_{i}} - R_{i}^{c} + {\sum\limits_{k \in B_{u}}R_{k}^{n_{k}}}} \right)}} & (15) \\{D_{remain} \geq {\alpha_{i}^{n_{i}}\quad R_{remain}}} & (16) \\{\alpha_{i}^{n_{i}} \leq \frac{D_{remain}}{R_{remain}}} & (17)\end{matrix}$

[0045] Using Eqn. (11) and Eqn. (13), it can be shown that α_(i) ^(n)^(_(i)) is bounded by D_(remain)/R_(remain). ForD_(remain)/R_(remain)≧1, and Eqn. (17) can be re-written to an unboundedform as $\begin{matrix}\begin{matrix}{{\alpha_{i}^{n_{i}} = {\frac{D_{remain}}{R_{remain}} \cdot \frac{1}{\beta_{i}^{n_{i}}}}},} & {\forall{\beta_{i}^{n_{i}} \geq 1}}\end{matrix} & (18)\end{matrix}$

[0046] where β_(i) ^(n) ^(_(i)) is a weighting factor. As theD_(remain)/R_(remain) will change for different truncation points, α_(i)^(n) ^(_(i)) is eventually required to be updated for each truncationpoint. Finally we have found the equation in calculating the value ofα_(i) ^(n) ^(_(i)) and the condition in Eqn. (10) becomes$\begin{matrix}{A_{i}^{n_{i} - 1} = {\frac{D_{i}^{n_{i} - 1}}{\Delta \quad R_{i}^{n_{i}}} \geq {\frac{D_{remain}}{R_{remain}} \cdot \frac{1}{\beta_{i}^{n_{i}}}}}} & (19)\end{matrix}$

[0047] Before actually encoding the sample data in-between thetruncation points n_(i) and n_(i)−1, the only unknown is R_(i) ^(n)^(_(i)) in Eqn. (19). Thus a maximum allowable rate different fortruncation point n_(i) can be computed such that $\begin{matrix}{{\max \quad \Delta \quad R_{i}^{n_{i}}} = {\beta_{i}^{n_{i}} \cdot D_{i}^{n_{i} - 1} \cdot \frac{R_{remain}}{D_{remain}}}} & (20)\end{matrix}$

[0048] Tier-1 coding of code-block B_(i) will be stopped when

ΔR_(i) ^(n) ^(_(i)) ≧max ΔR_(i) ^(n) ^(_(i))   (21)

[0049] In other words, the bit-stream of code-block B_(i) is truncatedat truncation point n_(i) when the condition in Eqn. (21) is satisfied.

[0050] It should be noted that this approximation approach has assumedthat the R-D ratio is monotonically decreasing (A_(i) ^(n) ^(_(i))⁺¹≦A_(i) ^(n) ^(_(i)) ). However, in real situations, the R-D ratiosevaluated at coding pass boundaries do not always follow themonotonically decreasing property. FIG. 2 shows the real R-D ratio curveof the first code-block for test image ‘Lena’. In order to have a betterapproximation, the R-D ratios may be evaluated at bit-plane boundariesbecause the distortion different between two consecutive bit-planes islarger than that between two consecutive coding passes. Thus the R-Dratios evaluated at bit-plane boundaries can follow the monotonicallydecreasing property much often than those evaluated at coding passesboundaries. In the standard, the bit-plane boundaries are defined atn_(i)=1, 4, 7, 10, . . . . Let b_(i)=1, 2, 3, . . . denotes thebit-plane truncation points for code-block B_(i) such thatb_(i)=3·┌n_(i)/3┐−2. Then the stopping criterion in Eqn. (21) becomes$\begin{matrix}{{R_{i}^{n_{i}} - R_{i}^{b_{i}}} \geq {\max \quad \Delta \quad R_{i}^{b_{i}}}} & (23) \\{where} & \quad \\\begin{matrix}{{{\max \quad \Delta \quad R_{i}^{b_{i}}} = {\beta_{i}^{b_{i}} \cdot D_{i}^{p_{i}} \cdot \frac{R_{remain}}{D_{remain}}}},} & \quad & {p_{i} = \left\{ \begin{matrix}{b_{i} - 1} & {b_{i} < 3} \\{b_{i} - 3} & {otherwise}\end{matrix} \right.}\end{matrix} & (24)\end{matrix}$

[0051] Eqn. (23) and Eqn. (24) will be used in this embodiment and canbe referred to as successive bit-plane rate allocation (SBRA). A simpleform of the SBRA method is to ignore the weighting factors β_(i) ^(b)^(_(i)) such that they are all set to one. This non-weighted method iscalled SBRA-1. However different weighting factors other than one can beused. This weighted method may be called SBRA-w.

[0052] As the SBRA method requires only the currently available R-Dinformation and information relating to the previously encoded data canbe forgotten, this method can provide both memoryless and casualfeatures. The encoded code-block data can be sent out immediately.

[0053] A. Linear Rate Regulation

[0054] The term β_(i) ^(b) ^(_(i)) in Eqn. (24) is used to reduce orcorrect the rate allocation error between the PCRD and SBRA method. Theβ_(i) ^(b) ^(_(i)) is defined for each bit-plane j and code-block i.However it is known that the image frequency characteristics are thesame with a subband. Thus a simple weighting factor defined for eachsubband is often sufficient. The term β_(i) ^(b) ^(_(i)) is thenre-indexed to be β_(r,θ) where r is the resolution level and θ is theorientation which are indexed as shown in FIG. 3.

[0055] In this modelling method, the rate profile of each subband isfirst examined using both the PCRD and SBRA-1 method for the fifteentest images shown in FIG. 4. The rates are measured in term of bit perpixel (bpp) and the average rate difference between PCRD and SBRA-1 isplotted in FIG. 5. It can be seen that SBRA-1 allocates fewer rates atlower resolution subbands and the rate allocation difference isapproximately linear decreasing from low to high resolution subbands.The rate allocation difference can be approximated by a linear curvewith slope related to target bit-rate. As the weighting factor in (24)directly controls the maximum allowable rate for a given bit-plane, alarger weighting factor can be used to increase the total bit-rateallocated for a given code-block. In other words, it is possible to havea later truncation point than that in SBRA-1. It may then be assume thatthe weighting factor is proportional to the achieved bit-rate for agiven code-block. Thus one can model β_(r,θ) by a linear equation suchthat $\begin{matrix}{\beta_{r,\theta} = {1 + {m*k_{r,\theta}}}} & (25) \\{and} & \quad \\{k_{r,\theta} = \left\{ \begin{matrix}{M - 1} & {{{for}\quad \left( {r,\theta} \right)} = \left( {0,0} \right)} \\{M - {3*\left( {r - 1} \right)} - \theta - 1} & {otherwise}\end{matrix} \right.} & (26)\end{matrix}$

[0056] where m is the slope of the linear curve. M is the total numberof subbands and (r,θ) is indexed as shown in FIG. 3. This weightingmodel is called linear rate regulation. Here it is assumed that thelinear model is applied for the coding order as shown in FIG. 6.

[0057] In general, m is dependent on image characteristics and targetbit-rate. However a close form relationship between the m and imagecharacteristics may require a complicated image analysis process. Thusmodel m as

m=R _(budget)/Δ  (27)

[0058] where Δ is a pre-defined constant and R_(budget) is the targetbit-rate in term of bpp. The constant Δ is chosen by an image-trainingmethod and the PSNR performance is the main criterion in finding thevalue of Δ. As a five-level DWT decomposition is used in allsimulations/implementation, the value of Δ for that configuration may befound. FIG. 7 shows the relationship between the values of Δ and averagePSNR performance of SBRA-w using the test images as shown in FIG. 4.This shows that the difference of the PSNR performance is less than 0.1dB in-between the values of three and ten and the value of five gives arelatively good result among them. Thus the value of Δ as five may beused in this embodiment.

[0059] B. Implementation

[0060] It should be noted that the coding could be stopped when maxΔR_(i) ^(b) ^(_(i)) in Eqn. (24) is small enough before actuallyencoding the coding pass. In other words, it is possible to earlyterminate the tier-1 coding process of a code block when

max ΔR_(i) ^(b) ^(_(i)) ≦T   (28)

[0061] In practical implementations, max ΔR_(i) ^(b) ^(_(i)) ispreferably rounded to nearest integer and the threshold T is set to zerobecause this is the simplest value that gives almost the highest PSNRperformance.

[0062] A second aspect of the invention (“Priority Scanning RateAllocation”, or “PSRA”) proposes to establish a priority level of eachcoding unit of each code-block. All the coding units of all code-blocksare then scanned and encoded according to the priority level, startingfrom the highest priority level towards the lowest.

[0063] By examining the PCRD scheme, it can be seen that if the R-Dslopes of all the allowable truncation point n_(i) are sorted indescending order and the order is kept in a sorted list, the optimalrate allocation can also be achieved by encoding the truncation pointfrom the top of the sorted list according to the sorted order. Thisleads to an interesting observation that, once the order is known, it isnot necessary to know the actual value of the R-D slope. The problem nowbecomes how to obtain the order without knowing all the values of theR-D slopes.

[0064] It is unlikely that the actual order list can be obtained withoutknowing the actual R-D information. Instead the order may be predictedbased on an assumption. Based on the assumed monotonically decreasingproperty of R-D slope function, an earlier truncation point will havelarger R-D slope than later truncation point within a code-block. Thisproperty can be extended to the whole image such that an earliertruncation point of any code-block is assumed to have a larger R-D slopethan later truncation points of other code-block(s).

[0065] By this assumption, the coding priority (order) is set based onthe truncation point level within an image. The coding pass with thehigher priority will be tier-1 encoded first followed by coding passeswith lower priority. The proposed method is called priority scanningrate allocation (PSRA) and is performed as follows:

[0066] 1. Initialization

[0067] For the i^(th) code block B_(i), the initial code-block priorityis equal to the maximum number of coding passes required to fully encodethe data in the code-block and is calculated by

P _(i)=3*j _(i) ⁰−2   (29)

[0068] where j_(i) ⁰ is the maximum number of bit-plane level requiredto fully encode the data in the code-block. The current coding priorityis defined as

P _(c)=max_(i)(P _(i))   (30)

[0069] 2. Priority Scanning

[0070] Visit each code-block according to the scan order as shown inFIG. 6. For each code-block B_(i), condition C1 is checked.

[0071] C1: If the code-block priority is equal to the current codingpriority (P_(i)=P_(c)), encode the first unencoded coding pass of B_(i),reduce P_(i) by one, calculate the R-D slope by Eqn. 4 and check thecondition C2. Else check the condition C3.

[0072] C2: if the accumulated bit-rate is larger than the targetbit-rate, find and discard the encoded coding pass(es) which has theminimum R-D slope(s) such that the accumulated bit-rate is less than orequal to the target bit-rate. The whole tier-1 coding process will beterminated at this point. Else check the condition C3.

[0073] C3: If the code-block is the last one in the scan order, reduceP_(c) by one and the next code-block will be the first one in the scanorder. Else visit the following code block.

[0074] The code-block priority in Eqn. (20) determines the truncationpoint level to be processed in the current round within an image. Itexploits the assumption that the highest truncation point level has thehighest R-D slope within an image. The current coding priority functionin Eqn. (30) is just an indication to indicate what priority will beincluded in the current scanning. Based on the actual R-D functions, thediscard of the included coding pass in the condition C2 can maximize thePSNR performance of this method.

[0075] The PSNR performance of PSRA might be degraded when thecoefficients do not follow the assumption. However experimental resultsshow that PSRA can have good PSNR performance for most test images.Different from SBRA, the encoded code-block data in PSRA can only besent out after the whole PSRA process is finished.

[0076] A third aspect of the invention (“Priority Scanning with OptimalTruncation”, or “PSOT”) proposes establishing a priority level of eachcoding unit of each code-block. All the coding units of all code-blocksare then scanned and encoded according to the priority level, startingfrom the highest priority level towards the lowest. When sufficientcoding levels of the code-blocks are encoded, rate-distortion optimizedallocation is applied.

[0077] The PCRD method achieves the best visual quality but is not themost efficient of the three methods because it requires encoding thewhole set of the allowable truncation points. Compared with PCRD, PSRAencodes a significantly smaller set of truncation points but the visualquality is less than optimal. Here a new method called Priority Scanningwith Optimal Truncation (PSOT) is proposed and which is able to achieveoptimal visual quality similar to PCRD, and computational complexitysimilar to PSRA.

[0078] First, the PSRA method is used to estimate a R-D slope that couldbe close to the optimal λ. Then a minimum slope rejection method is usedto terminate the tier-1 coding process of each code block such that thelast calculated R-D slope of each code block is less than or equal tothe estimated R-D slope. Finally, PCRD is applied to the encodedtruncation points. By doing so, instead of encoding all truncationpoints, only a smaller amount of truncation points are required to beencoded. This proposed scheme is called priority scanning with optimaltruncation (PSOT) and is performed as follows:

[0079] 1. Initialization & Priority Scanning

[0080] Perform PSRA as in Section IV. However, instead of termination,if the accumulated bit rate is larger than the target bit rate, go tostep 2.

[0081] 2. Minimum Slope Rejection

[0082] Find the minimum rate-distortion slope S_(min) among thecalculated R-D slopes in step 1. Visit each of the code-blocks andcontinue the Tier-1 encoding until the code block's minimumrate-distortion slope is less than or equal to the S_(min).

[0083] 3. Optimal Truncation

[0084] This step is essentially the PCRD method. The optimal λ is foundamong the encoded truncation points. Then the truncation points withrate-distortion slope greater than or equal to the optimal λ areincluded in the final code-stream.

[0085] If the S_(min) is less than or equal to the optimal λ, theproposed method will have the same PSNR performance as the conventionalPCRD scheme in JPEG2000. Same as PSRA, the encoded code-block data canonly be sent out after the whole PSOT process has been finished.

[0086] The embodiments of the invention described above are in terms ofJPEG2000 image coding. The code-block can be of any shape (e.g. squareor rectangular). The blocks may or may not be overlapping. Furthermore,it is not necessary to follow the coding order of the code-blocks inJPEG2000, and it is not necessary to define the coding passes as thesignificance pass, refinement pass and cleanup pass of JPEG2000. Othercoding passes are possible, including embedded zero-tree wavelet coding,or those of SPHIT, etc. Furthermore, it is not necessary to use discretewavelet transform. Other transforms such as discrete cosine transform,discrete Fourier transform, Hadamard tranform, Slant transform, etc. arepossible.

[0087] For the images, one picture element may have one or morecomponents such as the luminance component, the red, green, blue (RGB)components, the YUV components, the YCrCb components, the infra-redcomponents, the X-ray or other components. Each component of a pictureelement is a number, which may be a natural number, an integer, a realnumber or even a complex number. In the case of natural numbers, theymay be 12-bit, 8-bit, or any other bit resolution.

[0088] Moreover, the present invention in any of its aspects isapplicable not only to the encoding of images, but also to the ratecontrol or rate allocation in the encoding of audio signals, speechsignals, video signals, seismic signals, medical signals, etc.

[0089] The fast rate control process is mainly targeted for fast,low-delay and low cost software and hardware implementations ofJPEG2000. Possible applications include digital camera, digitalcamcorder, personal digital assistant (PDA), multimedia-enabled cellularphones (2.5G, 3G, and beyond), wireless LAN devices, Bluetoothapplications, web servers, internet applications, scanners, remotesensing, etc. In digital cameras, delay is very important. People oftencomplain that, after depressing the button, the camera would take a longtime to capture and store the image. This is becoming an increasingimportant problem as the digital images are getting bigger and bigger.Nowadays, some cameras have 5 mega pixels (about 2560×1920 pixels) ormore, which would require a significant amount of time to encode. Theproposed algorithm can reduce the time to store the image because itreduces significantly the time to convert the image into the JPEG2000format (by about 40%). The camera can be ready to take another picturemuch sooner. In additional, our algorithm requires much lesser memorythan PCRD so that cache memory requirement in hardware can be reducedand the implementation cost can be reduced. Nowadays, many digital video(DV) camcorders include still image capture capability. They would storethe captured image in a separate storage media such as multimedia card,or SD, etc. Users would experience similar complaints as they do indigital cameras, namely, a long delay in storing the images resulting inlong interval between consecutive image shots. Again the proposedalgorithm can reduce the delay significantly. Similarly, many PDAs,cellular phones, wireless LAN and Bluetooth devices, and notebookcomputers are increasing having video/image capture capability built-inor in add-on devices. A long delay in storing images would always resultin long interval between consecutive image shots, and the proposedalgorithm can reduce the delay.

1. A method of allocating or controlling the amount of bits for the encoding of source data, including: (i) defining the target bit rate for the encoding of the data; (ii) defining collections of coefficients of the data; (iii) defining a first global coding order of the said collections of coefficients; (iv) defining a plurality of coding units and corresponding allowable truncation points for each said collection of coefficients; (v) defining a second local coding order of the said coding units for each said collections of coefficients; (vi) defining a rate value and a distortion value for each said coding unit of each said collection of coefficients; (vii) defining a threshold value for each said coding unit of each said collection of coefficients; wherein, starting from the first coding unit according to the said local coding order of a said collection of coefficients, if a predetermined termination criterion is not met for a coding unit, the said coding unit will be included in the output code-stream, if the said termination criterion is met, the encoding of the collection of coefficients is terminated and no further coding unit according to the said local coding order of the said collection of coefficients will be encoded.
 2. A method as claimed in claim 1 wherein said collections of coefficients of the data are code-blocks.
 3. A method according to claim 1 in which the said rate value is the amount of bits needed to encode the said coding unit, or a first neighboring coding unit according to the local coding order, of the said collection of coefficients and the said distortion value is the distortion reduction due to the encoding of the said coding unit of the said collection of coefficients, or the encoding of a second neighboring coding unit according to the local coding order of the said collection of coefficients.
 4. A method according to claim 3 in which a rate-distortion value is computed from the said rate value and the said distortion value for each said coding unit of each said collection of coefficients, and the said termination criterion is that the rate-distortion value is below a threshold.
 5. A method according to claim 4 in which the said rate-distortion value is a fractional number with the denominator being the said rate value and the numerator being the said distortion value for each said coding unit of each said collection of coefficients.
 6. A method according to claim 4 in which the said rate-distortion value is a fractional number with the denominator being the said rate value and the numerator being the said distortion value for each said coding unit.
 7. A method according to claim 4 in which the threshold value is a predetermined constant common to all the collections of coefficients or can be different values such that a predetermined value is common to all the coding units of a collection of coefficients, or can be different values for different collections of coefficients and different coding units.
 8. A method according to claim 4 in which the threshold value is a fractional number with the denominator being the difference between the target bit rate and the total amount of bits used to encode all the past code-blocks according to the global coding order and all the earlier coding units of the current collection of coefficients according to the local coding order, and the numerator being the amount of distortion if the encoding terminates at that coding unit or a neighboring coding unit according to the local coding order.
 9. A method according to claim 4 in which the threshold value is the product of (a) a fractional number with the denominator being the difference between the target bit rate and the total amount of bits used to encode all the past collections of coefficients according to the global coding order and all the earlier coding units of the current collection of coefficients according to the local coding order, and the numerator being the product of the amount of distortion if the encoding terminates at that coding unit, or a neighboring unit according to the local coding order, and (b) an additional weighting factor.
 10. A method according to claim 1 in which the collections of coefficients are the code-blocks of coefficients of the source data in the data transform domain.
 11. A method according to claim 1 in which the collections of coefficients are the code-blocks of coefficients in the data transform domain, and the coding unit can be any intermediate coding pass.
 12. A method according to claim 11 wherein the data transform domain is the discrete wavelet domain in JPEG2000 and the intermediate coding pass is the significance pass, refinement pass or cleanup pass of JPEG2000.
 13. A method according to claim 1 in which the collections of coefficients are the code-blocks of coefficients in the data transform domain, and the coding order is predefined.
 14. A method according to claim 1 in which the collections of coefficients are the code-blocks of coefficients in the data transform domain of data formed by the difference of a first source data and a second source data.
 15. A method of allocating or controlling the amount of bits for the encoding of source data, including: (i) defining the target bit rate for the encoding of the data; (ii) defining collections of coefficients of the source data in the source data domain or in a data transform domain; (iii) defining a first global coding order of the said collections of coefficients; (iv) defining a plurality of coding units and corresponding allowable truncation points for each said collection of coefficients; (v) defining a second local coding order of the said coding units for each said collection of coefficients; (vi) defining a priority level of each said collection of coefficients; (vii) defining a global priority level for the said data; wherein, starting with the global priority level being the highest priority level among all collections of coefficients, all the collections of coefficients are examined one at a time, wherein for a collection of coefficients with priority level equal to the global priority level, the first un-encoded coding unit according to the local coding order is encoded and the priority level of the said collection of coefficients is reduced by one, wherein after all the collections of coefficients are examined, the global priority level is decreased by one and all the collections of coefficients are examined again, and the process continues iteratively until it terminates when the total amount of bits used is greater than the target bit rate, or when all the details of all the collections of coefficients have been encoded.
 16. A method as claimed in claim 15 wherein in the case of termination when the total bits exceed the target bit rate, the last coding units being encoded immediately before the total bits exceed the target bit rate may or may not be removed from the output code-stream.
 17. A method as claimed in claim 15 wherein in the case of termination when the total bits exceed the target bit rate, some additional un-encoded coding units of some code-blocks may or may not be encoded.
 18. A method as claimed in claim 15 wherein said collections of coefficients are code-blocks of coefficients in a data transform domain.
 19. A method of allocating or controlling the amount of bits for the encoding of source data, including: (i) defining the target bit rate for the encoding of the data; (ii) defining collections of coefficients of the source data; (iii) defining a first global coding order of the said collections of coefficients; (iv) defining a plurality of coding units and corresponding allowable truncation points for each said collection of coefficients; (v) defining a second local coding order of the said coding units for each said collection of coefficients; (vi) defining a priority level of each said collection of coefficients; (vii) defining a rate-distortion value for each said coding unit of each said collection of coefficients; wherein, starting with the current priority level being the highest priority level among all collections of coefficients, all the collections of coefficients are examined one at a time, wherein for a collection of coefficients with a priority level equal to the current priority level, the first un-encoded coding unit according to the local coding order is encoded and the priority level of the said collection of coefficients is reduced by one, wherein after all the collections of coefficients are examined, the current priority level is decreased by one and all the collections of coefficients are examined again, and the process continues iteratively until the total amount of bits used is greater than the target bit rate and the encoded coding unit with the least rate-distortion slope is removed and wherein this process is repeated until the total amount of bits used is less than or equal to the target bit rate.
 20. A method of allocating or controlling the amount of bits for the encoding of source data, including: (i) defining the target bit rate for the encoding of the source data; (ii) defining collections of coefficients of the source data; (iii) defining a first global coding order of the said collections of coefficients; (iv) defining a plurality of coding units and corresponding allowable truncation points for each said collection of coefficients; (v) defining a second local coding order of the said coding units for each said collection of coefficients; (vi) defining a priority level of each said collection of coefficients; (vii) defining a rate-distortion value for each said coding unit of each said collection of coefficients; wherein, starting with the current priority level being the highest priority level among all collections of coefficients, all the collections of coefficients are examined one at a time, wherein for a collection of coefficients with priority level equal to the current priority level, the first un-encoded coding unit according to the local coding order is encoded and the priority level of the said collection of coefficients is reduced by one, wherein after all the collections of coefficients are examined, the current priority level is decreased by one and all the collections of coefficients are examined again, and the process continues iteratively until the total amount of bits used is greater than the target bit rate at which point the global minimum rate-distortion slope among all the coding units of all the collections of coefficients is found and more encoding is performed in all the collections of coefficients, and wherein for each collection of coefficients, all the un-encoded coding units are encoded according to the local coding order until the rate-distortion slope is smaller than the global minimum rate-distortion slope and then the rate-distortion optimised rate-distortion slope is computed and used to select the optimal truncation for the coding units.
 21. A method according to claim 19 wherein the rate-distortion slope is a function of the rate value which is the amount of bits needed to encode the said coding unit, or a first neighboring coding unit according to the local coding order of the said collection of coefficients and the distortion value is the distortion reduction due to the encoding of the said coding unit of the said collection of coefficients, or the encoding of a second neighboring coding unit according to the local coding order of the said collection of coefficients.
 22. A method according to claim 21 wherein the rate-distortion value is a fractional number with the denominator being the said rate value and the numerator being the said distortion value for each said coding unit.
 23. A method according to claim 21 wherein the rate-distortion value is a fractional number with the denominator being the said rate value and the numerator being the said distortion value for each said coding unit, multiplied by a scaling factor value.
 24. A method according to claim 14 in which the code-blocks are examined according to the global coding order.
 25. A method according to claim 19 in which the priority level of each said code-block is equal to the total number of coding units needed to fully specify the said code-block.
 26. A method according to claim 19 in which the collections of coefficients are the code-blocks of coefficients in the discrete wavelet transform domain of the image or image tile, and the coding unit can be the significance pass, refinement pass or cleanup pass of JPEG2000.
 27. A method according to claim 19 in which the priority level of each said code-block is a linear function of the total number of bit planes needed to fully describe the wavelet coefficients.
 28. A software product for allocating or controlling the amount of bits for the encoding of source data, said software product including means for enabling the steps of: (i) defining the target bit rate for the encoding of the data; (ii) defining collections of coefficients of the data; (iii) defining a first coding order of the said collections of coefficients; (iv) defining a plurality of coding units and corresponding allowable truncation points for each said collection of coefficients; (v) defining a second coding order of the said coding units for each said collection of coefficients; (vi) defining a rate value and a distortion value for each said coding unit of each said collection of coefficients; (vii) defining a threshold value for each said coding unit of each said collection of coefficients; wherein said software product operates such that, starting from the first coding unit according to the said local coding order of a said collection of coefficients, if a predetermined termination criterion is not met for a coding unit, the said coding unit will be included in the output code-stream, if the said termination criterion is met, the encoding of the collection of coefficients is terminated and no further coding unit according to the said local coding order of the said collection of coefficients will be encoded.
 29. A software product as claimed in claim 28 wherein said collections of coefficients of the data are code-blocks.
 30. A software product as claimed in claim 28 in which the said rate value is the amount of bits needed to encode the said coding unit, or a first neighboring coding unit according to the local coding order, of the said collection of coefficients and the said distortion value is the distortion reduction due to the encoding of the said coding unit of the said collection of coefficients, or the encoding of a second neighboring coding unit according to the local coding order of the said collection of coefficients.
 31. A software product according to claim 30 in which a rate-distortion value is computed from the said rate value and the said distortion value for each said coding unit of each said collection of coefficients, and the said termination criterion is that the rate-distortion value is below a threshold.
 32. A software product according to claim 31 in which the said rate-distortion value is a fractional number with the denominator being the said rate value and the numerator being the said distortion value for each said coding unit of each said collection of coefficients.
 33. A software product according to claim 31 in which the said rate-distortion value is a fractional number with the denominator being the said rate value and the numerator being the said distortion value for each said coding unit.
 34. A software product according to claim 31 in which the threshold value is a predetermined constant common to all the collections of coefficients or can be different values such that a predetermined value is common to all the coding units of a collection of coefficients, or can be different values for different collections of coefficients and different coding units.
 35. A software product method according to claim 31 in which the threshold value is a fractional number with the denominator being the difference between the target bit rate and the total amount of bits used to encode all the past code-blocks according to the global coding order and all the earlier coding units of the current collection of coefficients according to the local coding order, and the numerator being the amount of distortion if the encoding terminates at that coding unit or a neighboring coding unit according to the local coding order.
 36. A software product according to claim 31 in which the threshold value is the product of (a) a fractional number with the denominator being the difference between the target bit rate and the total amount of bits used to encode all the past collections of coefficients according to the global coding order and all the earlier coding units of the current collection of coefficients according to the local coding order, and the numerator being the product of the amount of distortion if the encoding terminates at that coding unit, or a neighboring unit according to the local coding order, and (b) an additional weighting factor.
 37. A software product according to claim 28 in which the collections of coefficients are the code-blocks of coefficients of the source data in the data transform domain.
 38. A software product according to claim 28 in which the collections of coefficients are the code-blocks of coefficients in the data transform domain, and the coding unit can be any intermediate coding pass.
 39. A method according to claim 38 wherein the data transform domain is the discrete wavelet domain in JPEG2000 and the intermediate coding pass is the significance pass, refinement pass o cleanup pass of JPEG2000.
 40. A software product according to claim 28 in which the collections of coefficients are the code-blocks of coefficients in the data transform domain, and the coding order is predefined.
 41. A software product according to claim 28 in which the collections of coefficients are the code-blocks of coefficients in the data transform domain of data formed by the difference of a first source data and a second source data.
 42. A software product for allocating or controlling the amount of bits for the encoding of source data, said software product including means for enabling the steps of: (i) defining the target bit rate for the encoding of the data; (ii) defining collections of coefficients of the source data in the source data domain or in a data transform domain; (iii) defining a first global coding order of the said collections of coefficients; (iv) defining a plurality of coding units and corresponding allowable truncation points for each said collection of coefficients; (v) defining a second local coding order of the said coding units for each said collection of coefficients; (vi) defining a priority level of each said collection of coefficients; (vii) defining a global priority level for the said data; wherein said software product operates such that, starting with the global priority level being the highest priority level among all collections of coefficients, all the collections of coefficients are examined one at a time, wherein for a collection of coefficients with priority level equal to the global priority level, the first un-encoded coding unit according to the local coding order is encoded and the priority level of the said collection of coefficients is reduced by one, wherein after all the collections of coefficients are examined, the global priority level is decreased by one and all the collections of coefficients are examined again, and the process continues iteratively until it terminates when the total amount of bits used is greater than the target bit rate, or when all the details of all the collections of coefficients have been encoded.
 43. A software product as claimed in claim 42 wherein in the case of termination when the total bits exceed the target bit rate, the last coding units being encoded immediately before the total bits exceed the target bit rate may or may not be removed from the output code-stream.
 44. A software product as claimed in claim 42 wherein in the case of termination when the total bits exceed the target bit rate, some additional un-encoded coding units of some code-blocks may or may not be encoded.
 45. A software product as claimed in claim 42 wherein said collections of coefficients are code-blocks of coefficients in a data transform domain.
 46. A software product for allocating or controlling the amount of bits for the encoding of source data, said software product including means for: (i) defining the target bit rate for the encoding of the data; (ii) defining collections of coefficients of the source data; (iii) defining a first global coding order of the said collections of coefficients; (iv) defining a plurality of coding units and corresponding allowable truncation points for each said collection of coefficients; (v) defining a second local coding order of the said coding units for each said collection of coefficients; (vi) defining a priority level of each said collection of coefficients; (vii) defining a rate-distortion value for each said coding unit of each said collection of coefficients; wherein said software product operates such that, starting with the current priority level being the highest priority level among all collections of coefficients, all the collections of coefficients are examined one at a time, wherein for a collection of coefficients with a priority level equal to the current priority level, the first un-encoded coding unit according to the local coding order is encoded and the priority level of the said collection of coefficients is reduced by one, wherein after all the collections of coefficients are examined, the current priority level is decreased by one and all the collections of coefficients are examined again, and the process continues iteratively until the total amount of bits used is greater than the target bit rate and the encoded coding unit with the least rate-distortion slope is removed and wherein this process is repeated until the total amount of bits used is less than or equal to the target bit rate.
 47. A software product for allocating or controlling the amount of bits for the encoding of source data, said software product including means for enabling the steps of: (i) defining the target bit rate for the encoding of the data; (ii) defining collections of coefficients of the source data; (iii) defining a first global coding order of the said collections of coefficients; (iv) defining a plurality of coding units and corresponding allowable truncation points for each said collection of coefficients; (v) defining a second local coding order of the said coding units for each said collection of coefficients; (vi) defining a priority level of each said collection of coefficients; (vii) defining a rate-distortion value for each said coding unit of each said collection of coefficients; wherein said software product operates such that, starting with the current priority level being the highest priority level among all collections of coefficients, all the collections of coefficients are examined one at a time, wherein for a code-block with priority level equal to the current priority level, the first un-encoded coding unit according to the local coding order is encoded and the priority level of the said collection of coefficients is reduced by one, wherein after all the collections of coefficients are examined, the current priority level is decreased by one and all the collections of coefficients are examined again, and the process continues iteratively until the total amount of bits used is greater than the target bit rate at which point the global minimum rate-distortion slope among all the coding units of all the collections of coefficients is found and more encoding is performed in all the collections of coefficients, and wherein for each collection of coefficients, all the un-encoded coding units are encoded according to the local coding order until the rate-distortion slope is smaller than the global minimum rate-distortion slope and then the rate-distortion optimised rate-distortion slope is computed and used to select the optimal truncation for the coding units.
 48. A software product according to claim 46 wherein the rate-distortion slope is a function of the rate value which is the amount of bits needed to encode the said coding unit, or a first neighboring coding unit according to the local coding order of the said collection of coefficients and the distortion value is the distortion reduction due to the encoding of the said coding unit of the said collection of coefficients, or the encoding of a second neighboring coding unit according to the local coding order of the said collection of coefficients.
 49. A software product according to claim 48 wherein the rate-distortion value is a fractional number with the denominator being the said rate value and the numerator being the said distortion value for each said coding unit.
 50. A software product according to claim 48 wherein the rate-distortion value is a fractional number with the denominator being the said rate value and the numerator being the said distortion value for each said coding unit, multiplied by a scaling factor value.
 51. A software product according to claim 41 in which the code-blocks are examined according to the global coding order.
 52. A software product according to claim 46 in which the priority level of each said code-block is equal to the total number of coding units needed to fully specify the said code-block.
 53. A software product according to claim 46 in which the collections of coefficients are the code-blocks of coefficients in the discrete wavelet transform domain of the image or image tile, and the coding unit can be the significance pass, refinement pass or cleanup pass of JPEG2000.
 54. A software product according to claim 46 in which the priority level of each said code-block is a linear function of the total number of bit planes needed to fully describe the wavelet coefficients.
 55. Apparatus for allocating or controlling the amount of bits for the encoding of source data, said software product including means for enabling the steps of: (i) defining the target bit rate for the encoding of the data; (ii) defining collections of coefficients of the data; (iii) defining a first coding order of the said collections of coefficients; (iv) defining a plurality of coding units and corresponding allowable truncation points for each said collection of coefficients; (v) defining a second coding order of the said coding units for each said collection of coefficients; (vi) defining a rate value and a distortion value for each said coding unit of each said collection of coefficients; (vii) defining a threshold value for each said coding unit of each said collection of coefficients; wherein said apparatus operates such that, starting from the first coding unit according to the said local coding order of a said collection of coefficients, if a predetermined termination criterion is not met for a coding unit, the said coding unit will be included in the output code-stream, if the said termination criterion is met, the encoding of the collection of coefficients is terminated and no further coding unit according to the said local coding order of the said collection of coefficients will be encoded.
 56. Apparatus as claimed in claim 55 wherein said collections of coefficients of the data are code-blocks.
 57. Apparatus as claimed in claim 55 in which the said rate value is the amount of bits needed to encode the said coding unit, or a first neighboring coding unit according to the local coding order, of the said collection of coefficients and the said distortion value is the distortion reduction due to the encoding of the said coding unit of the said collection of coefficients, or the encoding of a second neighboring coding unit according to the local coding order of the said collection of coefficients.
 58. Apparatus as claimed in claim 57 in which a rate-distortion value is computed from the said rate value and the said distortion value for each said coding unit of each said collection of coefficients, and the said termination criterion is that the rate-distortion value is below a threshold.
 59. Apparatus as claimed in claim 58 in which the said rate-distortion value is a fractional number with the denominator being the said rate value and the numerator being the said distortion value for each said coding unit of each said collection of coefficients.
 60. Apparatus as claimed in claim 58 in which the said rate-distortion value is a fractional number with the denominator being the said rate value and the numerator being the said distortion value for each said coding unit.
 61. Apparatus as claimed in claim 58 in which the threshold value is a predetermined constant common to all the collections of coefficients or can be different values such that a predetermined value is common to all the coding units of a collection of coefficients, or can be different values for different collections of coefficients and different coding units.
 62. Apparatus as claimed in claim 58 in which the threshold value is a fractional number with the denominator being the difference between the target bit rate and the total amount of bits used to encode all the past code-blocks according to the global coding order and all the earlier coding units of the current collection of coefficients according to the local coding order, and the numerator being the amount of distortion if the encoding terminates at that coding unit or a neighboring coding unit according to the local coding order.
 63. Apparatus as claimed in claim 58 in which the threshold value is the product of (a) a fractional number with the denominator being the difference between the target bit rate and the total amount of bits used to encode all the past collections of coefficients according to the global coding order and all the earlier coding units of the current collection of coefficients according to the local coding order, and the numerator being the product of the amount of distortion if the encoding terminates at that coding unit, or a neighboring unit according to the local coding order, and (b) an additional weighting factor.
 64. Apparatus as claimed in claim 55 in which the collections of coefficients are the code-blocks of coefficients of the source data in the data transform domain.
 65. Apparatus as claimed in claim 55 in which the collections of coefficients are the code-blocks of coefficients in the data transform domain, and the coding unit can be any intermediate coding pass.
 66. Apparatus as claimed in claim 65 wherein the data transform domain is the discrete wavelet domain in JPEG2000 and the intermediate coding pass is the significance pass, refinement pass or cleanup pass of JPEG2000.
 67. Apparatus as claimed in claim 55 in which the collections of coefficients are the code-blocks of coefficients in the data transform domain, and the coding order is predefined.
 68. Apparatus as claimed in claim 5 in which the collections of coefficients are the code-blocks of coefficients in the data transform domain of data formed by the difference of a first source data and a second source data.
 69. Apparatus for allocating or controlling the amount of bits for the encoding of source data, said apparatus including means for enabling the steps of: (i) defining the target bit rate for the encoding of the data; (ii) defining collections of coefficients of the source data in the source data domain or in a data transform domain; (iii) defining a first global coding order of the said collections of coefficients; (iv) defining a plurality of coding units and corresponding allowable truncation points for each said collection of coefficients; (v) defining a second local coding order of the said coding units for each said collection of coefficients; (vi) defining a priority level of each said collection of coefficients; (vii) defining a global priority level for the said data; wherein said apparatus operates such that, starting with the global priority level being the highest priority level among all collections of coefficients, all the collections of coefficients are examined one at a time, wherein for a collection of coefficients with priority level equal to the global priority level, the first un-encoded coding unit according to the local coding order is encoded and the priority level of the said collection of coefficients is reduced by one, wherein after all the collections of coefficients are examined, the global priority level is decreased by one and all the collections of coefficients are examined again, and the process continues iteratively until it terminates when the total amount of bits used is greater than the target bit rate, or when all the details of all the collections of coefficients have been encoded.
 70. Apparatus as claimed in claim 69 wherein in the case of termination when the total bits exceed the target bit rate, the last coding units being encoded immediately before the total bits exceed the target bit rate may or may not be removed from the output code-stream.
 71. Apparatus as claimed in claim 69 wherein in the case of termination when the total bits exceed the target bit rate, some additional un-encoded coding units of some code-blocks may or may not be encoded.
 72. Apparatus as claimed in claim 69 wherein said collections of coefficients are code-blocks of coefficients in a data transform domain.
 73. Apparatus for allocating or controlling the amount of bits for the encoding of source data, said apparatus including means for: (i) defining the target bit rate for the encoding of the data; (ii) defining collections of coefficients of the source data; (iii) defining a first global coding order of the said collections of coefficients; (iv) defining a plurality of coding units and corresponding allowable truncation points for each said collection of coefficients; (v) defining a second local coding order of the said coding units for each said collection of coefficients; (vi) defining a priority level of each said collection of coefficients; (vii) defining a rate-distortion value for each said coding unit of each said collection of coefficients; wherein said apparatus operates such that, starting with the current priority level being the highest priority level among all collections of coefficients, all the collections of coefficients are examined one at a time, wherein for a collection of coefficients with a priority level equal to the current priority level, the first un-encoded coding unit according to the local coding order is encoded and the priority level of the said collection of coefficients is reduced by one, wherein after all the collections of coefficients are examined, the current priority level is decreased by one and all the collections of coefficients are examined again, and the process continues iteratively until the total amount of bits used is greater than the target bit rate and the encoded coding unit with the least rate-distortion slope is removed and wherein this process is repeated until the total amount of bits used is less than or equal to the target bit rate.
 74. Apparatus for allocating or controlling the amount of bits for the encoding of source data, said apparatus including means for enabling the steps of: (i) defining the target bit rate for the encoding of the data; (ii) defining collections of coefficients of the source data; (iii) defining a first global coding order of the said collections of coefficients; (iv) defining a plurality of coding units and corresponding allowable truncation points for each said collection of coefficients; (v) defining a second local coding order of the said coding units for each said collection of coefficients; (vi) defining a priority level of each said collection of coefficients; (vii) defining a rate-distortion value for each said coding unit of each said collection of coefficients; wherein said apparatus operates such that, starting with the current priority level being the highest priority level among all collections of coefficients, all the collections of coefficients are examined one at a time, wherein for a code-block with priority level equal to the current priority level, the first un-encoded coding unit according to the local coding order is encoded and the priority level of the said collection of coefficients is reduced by one, wherein after all the collections of coefficients are examined, the current priority level is decreased by one and all the collections of coefficients are examined again, and the process continues iteratively until the total amount of bits used is greater than the target bit rate at which point the global minimum rate-distortion slope among all the coding units of all the collections of coefficients is found and more encoding is performed in all the collections of coefficients, and wherein for each collection of coefficients, all the un-encoded coding units are encoded according to the local coding order until the rate-distortion slope is smaller than the global minimum rate-distortion slope and then the rate-distortion optimised rate-distortion slope is computed and used to select the optimal truncation for the coding units.
 75. Apparatus according to claim 73 wherein the rate-distortion slope is a function of the rate value which is the amount of bits needed to encode the said coding unit, or a first neighboring coding unit according to the local coding order of the said collection of coefficients and the distortion value is the distortion reduction due to the encoding of the said coding unit of the said collection of coefficients, or the encoding of a second neighboring coding unit according to the local coding order of the said collection of coefficients.
 76. Apparatus as claimed in claim 75 wherein the rate-distortion value is a fractional number with the denominator being the said rate value and the numerator being the said distortion value for each said coding unit.
 77. Apparatus as claimed in claim 75 wherein the rate-distortion value is a fractional number with the denominator being the said rate value and the numerator being the said distortion value for each said coding unit, multiplied by a scaling factor value.
 78. Apparatus as claimed in claim 68 in which the code-blocks are examined according to the global coding order.
 79. Apparatus as claimed in claim 73 in which the priority level of each said code-block is equal to the total number of coding units needed to fully specify the said code-block.
 80. Apparatus as claimed in claim 73 in which the collections of coefficients are the code-blocks of coefficients in the discrete wavelet transform domain of the image or image tile, and the coding unit can be the significance pass, refinement pass or cleanup pass of JPEG2000.
 81. Apparatus as claimed in claim 73 in which the priority level of each said code-block is a linear function of the total number of bit planes needed to fully describe the wavelet coefficients. 